package com.myprocessing.gui.util;

import java.util.ArrayList;

public class Polygon {

	private ArrayList<Coord> coords;
	private java.awt.Polygon polygon;
	
	public ArrayList<Coord> getCoords() {
		return coords;
	}
	
	public void setCoords(ArrayList<Coord> coords) {
		this.coords = coords;
		polygon = new java.awt.Polygon();
		for (Coord coord: coords) {
			polygon.addPoint(coord.getX(), coord.getY());
		}
	}
	
	public java.awt.Polygon getPolygon() {
		return polygon;
	}
	
	public void setPolygon(java.awt.Polygon polygon) {
		this.polygon = polygon;
	}
	
	public boolean contains(Coord coord) {
		return polygon.contains(coord.getX(), coord.getY());
	}
	
	public boolean contains(int cx, int cy) {
		return polygon.contains(cx, cy);
	}
	
}
